package cn.tedu.front.details.controller;

import cn.tedu.common.web.JsonResult;
import cn.tedu.front.details.pojo.vo.CityVO;
import cn.tedu.front.details.service.CityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "切换城市")
public class CityController {
    @Autowired
    private CityService cityService;

    @GetMapping("/city")
    @ApiOperation(value = "根据父级id查询城市")
    public JsonResult listByParent(Long parentId){
        List<CityVO> cityVOS = cityService.listByParent(parentId);
        return JsonResult.ok(cityVOS);
    }
}
